package ru.neoflex.jedit.plugin.domain;

import com.thoughtworks.xstream.annotations.XStreamAlias;
import com.thoughtworks.xstream.XStream;

import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.util.Collection;
import java.util.LinkedHashSet;
import java.util.Map;
import java.util.Set;

@XStreamAlias("Project")
public class Project {
    private Set<String> sourceFolders = new LinkedHashSet<String>();
    private Set<String> webFolders = new LinkedHashSet<String>();

    static void saveToXml(Project project, String filename) throws IOException {
        XStream xs = new XStream();
        xs.processAnnotations(Project.class);
        xs.toXML(project, new FileWriter(filename));
    }

    static Project loadFromXml(String filename) throws FileNotFoundException {
        XStream xs = new XStream();
        xs.processAnnotations(Project.class);
        return (Project) xs.fromXML(new FileReader(filename));
    }

    public Set<String> getSourceFolders() {
        return sourceFolders;
    }

    public void setSourceFolders(Set<String> sourceFolders) {
        this.sourceFolders = sourceFolders;
    }

    public Set<String> getWebFolders() {
        return webFolders;
    }

    public void setWebFolders(Set<String> webFolders) {
        this.webFolders = webFolders;
    }
}
